<template>
  <div v-loading="loading" element-loading-text="努力拉取科目中...">
    <el-row :gutter="20" v-show="$route.name==='subject'">
      <m-card v-for="i in subject" :span="6" :to="{name:'questionBank',params:{subId:i.ID}}">
        <h1>{{i.KM_NAME}}</h1>
        <span>{{i.number}}套</span>
      </m-card>
    </el-row>
    <router-view/>
  </div>
</template>

<script>
  import {mapActions, mapState} from "vuex";

  export default {
    name: "subject",
    data() {
      return {
        loading: false
      }
    },
    created() {
      this.loading = true
      this.getSubject().finally(() => this.loading = false)
    },
    computed: {
      ...mapState({
        subject: state => state.subject
      })
    },
    methods: {
      ...mapActions(['getSubject'])
    },
  }
</script>

<style scoped>
</style>
